package com.techstar.ats.status;

import java.util.Set;

public enum SignalStatus implements StatusEnumerated {
	RED_OPEN(0x00000001, "红灯亮"),
	RED_FLASH(0x00000002, "红灯闪"),
	GREEN_OPEN(0x00000004, "绿灯亮"),
	GREEN_FLASH(0x00000008, "绿灯闪"),
	YELLOW_OPEN(0x0000010, "黄灯亮"),
	YELLOW_FLASH(0x00000020, "黄灯闪"),
	WHITE_OPEN(0x00000040, "白灯亮"),
	WHITE_FLASH(0x00000080, "白灯闪"),
	BLUE_OPEN(0x00000100, "蓝灯亮"),
	BLUE_FLASH(0x00000200, "蓝灯闪"),
	FLEET_MODE(0x00010000, "信号机fleet模式"),
	CTRL_FLEET_MODE(0x00020000, "设置或取消信号机fleet模式办理中"),
	AUTO_MODE(0x00040000, "信号机处于auto模式，即允许信号机为始端进路自动触发"),
	EXTINGUISH(0x00100000, "信号机处于灭灯状态"),
	APPROACH_LOCK(0x00200000, "进路处于接近锁闭"),
	PROTECT_ROUTE(0x00400000, "进路的保护进路已办理"),
	AUTO_ROUTE_DISABLE(0x00800000, "信号机后方有进路被关闭自动触发功能"),
	CALLON(0x01000000, "信号机引导状态"),
	YELLOW_YELLOW(0x02000000, "信号机双黄灯"),
	YELLOW_GREEN(0x04000000, "信号机黄绿灯"),
	BLOCKED(0x08000000, "信号机封锁"),
	LAMP_FAILURE(0x10000000, "信号机灯丝断丝");

	private final int value;
	private final String literal;

	SignalStatus(int value, String literal) {
		this.value = value;
		this.literal = literal;
	}

	@Override
	public int value() {
		return this.value;
	}

	@Override
	public String literal() {
		return this.literal;
	}

	public static Set<SignalStatus> valueOf(int mask) {
		return StatusEnumerated.valueOf(SignalStatus.class, mask);
	}
}
